package com.movie2.service.impl;

import com.movie2.mapper.FilmReviewMapper;
import com.movie2.model.entity.FilmReview;
import com.movie2.service.FilmReviewService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Map;


/**
 * 
 * FilmReviewService业务逻辑操作接口类的实现类
 * 
 **/

@Service
@Transactional
@Slf4j
public class FilmReviewServiceImpl implements FilmReviewService {

	@Autowired
	FilmReviewMapper filmReviewMapper;

	//根据电影id查询
	public List<FilmReview> selectFilmReviewsByFid(Integer fid){
		log.info("通过fid查询FilmReview信息:selectFilmReviewsByFid() ");
		return filmReviewMapper.selectFilmReviewsByFid(fid);
	}

	//查询（根据主键ID查询）
	public FilmReview selectByPrimaryKey (Integer id){
		log.info("通过主键查询FilmReview信息:selectByPrimaryKey() ");
		return filmReviewMapper.selectByPrimaryKey(id);
	}

	//查询（获得数据表中的数量）
	public int selectFilmReviewCount(){
		log.info("获得FilmReview数量信息:selectFilmReviewCount() ");
		return filmReviewMapper.selectFilmReviewCount();
	}

	//查询全部信息
	public List<FilmReview>  selectAllFilmReviews ( ){
		log.info("获得全部FilmReview信息:selectAllFilmReviews() ");
		return filmReviewMapper.selectAllFilmReviews ( );
	}

	//查询（根据其他条件查询需要的结果）

	public int selectFilmReviewsCountByCondition(Map<String,Object> map){
		log.info("根据其他条件查询需要的FilmReview信息:selectFilmReviewsCountByCondition() ");
		return filmReviewMapper.selectFilmReviewsCountByCondition(map);
	}

	//查询（通过Map条件，获得所有符合的信息）

	public List<FilmReview> selectFilmReviewsCondition(Map<String,Object> map){
		log.info("根据其他条件查询需要的FilmReview信息:selectFilmReviewsCountByCondition() ");
		return filmReviewMapper.selectFilmReviewsCondition(map);
	}

	//查询（通过条件进行分页查询）

	public List<FilmReview> selectFilmReviewsPerPageByCondition(Map<String,Object> map){
		log.info("通过条件进行分页查询FilmReview信息:selectFilmReviewsPerPageByCondition() ");
		return filmReviewMapper.selectFilmReviewsPerPageByCondition(map);
	}

	//条件查询
	public List<FilmReview>  selectFilmReviewsByCondition (FilmReview record){
		log.info("通过传入的参数条件FilmReview信息进行查询:selectFilmReviewsByCondition () ");
		return filmReviewMapper.selectFilmReviewsByCondition(record);
	}

	//删除（条件删除）
	public int deleteByCondition( FilmReview record ){
		log.info("根据传入的FilmReview信息，条件删除:deleteByCondition() ");
		return filmReviewMapper.deleteByCondition(record);
	}

	//删除（根据主键ID删除）
	public int deleteByPrimaryKey (Integer id ){
		log.info("主键ID删除FilmReview信息:deleteByPrimaryKey() ");
		return filmReviewMapper.deleteByPrimaryKey(id);
	}

	//添加
	public int insert( FilmReview record ){
		log.info("新增FilmReview信息:insert() ");
		return filmReviewMapper.insert(record);
	}

	//添加 （匹配有值的字段）
	public int insertSelective( FilmReview record ){
		log.info("新增（匹配有值的字段）FilmReview信息:insertSelective() ");
		return filmReviewMapper.insertSelective(record);
	}

	//修改 （匹配有值的字段）
	public int updateByPrimaryKeySelective( FilmReview record ){
		log.info("修改（匹配有值的字段）FilmReview信息:updateByPrimaryKeySelective() ");
		return filmReviewMapper.updateByPrimaryKeySelective(record);
	}

	//修改（根据主键ID修改）
	public int updateByPrimaryKey ( FilmReview record ){
		log.info("修改FilmReview信息:updateByPrimaryKey() ");
		return filmReviewMapper.updateByPrimaryKey(record);
	}

}